Page({
  onLoad({ building, point }) {
    this.fuck(building, point)
  },

  // 生成随机房间号
  fuck(building, point) {
    // 总房间
    const size = Math.floor(Math.random() * 5) + 4
    const rooms = []

    for (let i = 0; i < size; i++) {
      // 生成楼层号
      const floor = Math.floor(Math.random() * 19) + 1
      // 具体的房间号
      const No = Math.floor(Math.random() * 2) + 1
      // 合并楼层房间号
      const room = [floor, 0, No].join('')
      // 检查是否有重复的
      if (rooms.includes(room)) return
      rooms.push(room)
    }

    // 渲染
    this.setData({ rooms, point, building })
  },
})
